package com.animationtest;

import android.app.Activity;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.TransitionDrawable;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class AnimationTest extends Activity {
	/** Called when the activity is first created. */
	LinearLayout mLinearLayout;

	@Override
	public void onCreate(Bundle savedInstanceState) {
//		super.onCreate(savedInstanceState);
//		setContentView(R.layout.main);
//		// ImageView rocketImage = (ImageView) findViewById(R.id.rocket_image);
//		// rocketImage.setBackgroundResource(R.anim.rocket_thrust);
//		// rocketAnimation = (AnimationDrawable) rocketImage.getBackground();

		super.onCreate(savedInstanceState);
		mLinearLayout = new LinearLayout(this);
		ImageView i = new ImageView(this);
		i.setAdjustViewBounds(true);
		i.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
		mLinearLayout.addView(i);
		setContentView(mLinearLayout);
		Resources res = getResources();
		TransitionDrawable transition = (TransitionDrawable) res.getDrawable(R.drawable.expand_collapse);
		i.setImageDrawable(transition);
		transition.startTransition(3000);

	}

	public static TransitionDrawable getTransitionDrawable(Drawable[] drawables) {
		TransitionDrawable transitionDrawable = new TransitionDrawable(drawables);

		return transitionDrawable;
	}
}